import request from '@/utils/request'

// 查询数据点位定义列表
export function listPoint(query) {
  return request({
    url: '/point/point/list',
    method: 'get',
    params: query
  })
}

// 查询数据点位定义详细
export function getPoint(id) {
  return request({
    url: '/point/point/' + id,
    method: 'get'
  })
}

// 新增数据点位定义
export function addPoint(data) {
  return request({
    url: '/point/point',
    method: 'post',
    data: data
  })
}

// 修改数据点位定义
export function updatePoint(data) {
  return request({
    url: '/point/point',
    method: 'put',
    data: data
  })
}

// 删除数据点位定义
export function delPoint(id) {
  return request({
    url: '/point/point/' + id,
    method: 'delete'
  })
}

export const getPointByDeviceId = (id) => request.get('/point/byDeviceId/' + id)
export const savePointBatch = (points) =>
  request.post('/point/batch/save', points)
